<template>
  <div>
    <ul>
      <li v-for="(item, index) in users" :key="index" @click="childClick(item)">
        {{ item }}
      </li>
    </ul>
  </div>
</template>

<script lang="ts">
import { defineComponent } from "vue";

export default defineComponent({
  name: "YuiList",
  data() {
    return {
      name: "",
      childValue: "eqwe",
      param: {
        name: "",
        childValue: "eqwe",
        user:''
      },
      //   users:['qweqwe','eqweqw','tret']
    };
  },
  //   接收
  props: {
    users: {
      //父组件传子组件
      type: Array,
      required: true,
    },
  },
  methods: {
    childClick(value:any) {
      console.log(this.childValue);
      this.param.user=value
      this.$emit("test", this.param);
    },
  },
});
</script>